import 'package:flutter/material.dart';

class AnumateLogo extends AnimatedWidget {

  const AnumateLogo({Key key, Animation<double> animation}): super(key: key, listenable: animation);

  @override
  Widget build(BuildContext context) {
    final Animation<double> animation = listenable;
    return Column(
            children: <Widget> [
              Container(child: const Text('wen zi 1', overflow: TextOverflow.clip),height:animation.value * 10,),
              Container(child: const Text('wen zi 1', overflow: TextOverflow.clip),height:animation.value * 10),
              Container(child: const Text('wen zi 1', overflow: TextOverflow.clip),height:animation.value * 10),
              Container(child: const Text('wen zi 1', overflow: TextOverflow.clip),height:animation.value * 10),
            ]
    );
  }
}

class Slidown extends StatefulWidget {
  @override
  _Slidown createState() => _Slidown();
}

class _Slidown extends State<Slidown> with TickerProviderStateMixin {
  AnimationController controller;
  @override
  void initState() {
    super.initState();
    controller = AnimationController(
        duration: const Duration(milliseconds: 500), 
        vsync: this
    );
  }
  String tip = '下拉';
  void onPress () {
    if (tip == '下拉') {
      setState(() => tip = '收起');
      controller.forward();
    } else {
      setState(() => tip = '下拉');
      controller.reverse();
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('动画效果展示'),
      ),
      body: ListView(
        children: <Widget>[
          FlatButton(
            child: Text(tip),
            onPressed: onPress,
          ),
          AnumateLogo(animation: controller),
        ]
      ),
    );
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }
}